﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;
using Husb.Data;

using CentralOffice.Admin.Data;
using CentralOffice.Admin.DataAccess;
using ProcessTable = CentralOffice.Admin.Data.ApprovalProcessDataSet.ApprovalProcessDataTable;
using ProcessRow = CentralOffice.Admin.Data.ApprovalProcessDataSet.ApprovalProcessRow;

namespace CentralOffice.Admin.BusinessActions
{
    public class ApprovalProcess : DataAccessManager<ApprovalProcessDataSet, ProcessTable, ProcessRow, ApprovalProcessAdapter>
    {
        public static ProcessTable GetProcessBySubject(int subjectId)
        {
            ProcessTable processes = new ProcessTable();
            ProcessTable p = GetAll();
            foreach (ProcessRow row in p.Rows)
            {
                if (row.ApprovalObject == subjectId && !row.IsDeleted && row.IsActive)
                {
                    processes.ImportRow(row);
                }
            }

            return processes;
        }
    }
}
